// pages/game/game.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  },
  tapName: function (event) {
    console.log(event)
  },
  startTap:function(){
    console.log("开始摸")
  },
  moveTap:function(e){

    console.log(e.currentTarget.offsetLeft)
    console.log(e.currentTarget.offsetTop)
  },
  handleTap1:function(){
    console.log("外部被点击")
  },
  handleTap2:function(){
    console.log("中间被点击")
  },
  handleTap3:function(){
    console.log("内部被点击")
  },
  dateDemo:function(){
    console.log(Date.parse("2018-11-13"))
    console.log(Date.UTC(2018,9,30))
    console.log(Date.now())
    console.log(Date.toString())
    var d = new Date()
    console.log(d.toDateString())
    console.log(d.toTimeString())
    console.log(d.toLocaleString())
    console.log(d.toLocaleTimeString())
    console.log(d.valueOf())
    console.log("Time"+d.getTime())
    console.log("Year"+d.getFullYear())
    console.log("UTCYear"+d.getUTCFullYear())
    console.log("Month"+d.getMonth())
    console.log("UTCMonth"+d.getUTCMonth())
    console.log("Date"+d.getDate())
    console.log("UTCDate"+d.getUTCDate())
    console.log("Day"+d.getDay())
    console.log("UTCDay"+d.getUTCDay())
    console.log("Hours"+d.getHours())
    console.log("UTCHours"+d.getUTCHours())
    console.log("Minutes"+d.getMinutes())
    console.log("UTCMinutes"+d.getUTCMinutes())
    console.log("Seconds"+d.getSeconds())
    console.log("UTCSecods"+d.getUTCSeconds())
    console.log("millseconds"+d.getMilliseconds())
    console.log("UTCMillseconds"+d.getUTCMilliseconds())
    console.log("时间差"+d.getTimezoneOffset())
    d.setTime(150000000000)
    console.log("150000000000毫秒后的日期" + d.toLocaleString())
    console.log("JSON"+d.toJSON())
    d = new Date()
    console.log("现在" + d.toLocaleDateString())
    d.setMonth(1)
    console.log("12个月后"+d.toLocaleDateString())
  },
  constructorDemo:function(){
  //console.log("   "+)

    console.log(Math.E)
    console.log(Math.log10(100))
    console.log(Math.LN10)
    console.log(Math.LN2)
    console.log(Math.LOG2E)
    console.log(Math.LOG10E)
    console.log(Math.PI)
    console.log(Math.SQRT1_2)
    console.log(Math.SQRT2)
    console.log("绝对值   "+Math.abs(-0.19))
    console.log("反余弦值   " +Math.acos(0.5))
    console.log("计算坐标与X轴角度   " +Math.atan2(4,4))
    console.log("向下取整   " +Math.floor(1.9))
    console.log("四舍五入   " +Math.round(1.45))
    console.log("取较大值   " +Math.max(1,2,3,4,5))
    console.log("取较小值   " + Math.min(1, 2, 3, 4, 5))
    console.log("a的b次幂   " +Math.pow(3,4))
    console.log("随机数   " +Math.random())
  },
  jsonDemo:function(){
    //console.log("   "+)
    var object = {age:10,sex:"男"}
    var str = JSON.stringify(object)
    console.log("对象转json   " + str)
    var jsonObject = JSON.parse(str)
    console.log("json转对象   " + jsonObject.age + jsonObject.sex)
  },
  numberDemo:function(){
    //console.log("   "+)
    console.log("最大值   " + Number.MAX_VALUE)
    console.log("最小值   " +Number.MIN_VALUE)
    console.log("负无穷大   " +Number.NEGATIVE_INFINITY)
    console.log("正无穷大   " +Number.POSITIVE_INFINITY)
  },
  globalDemo:function(){
    //console.log("   "+)
    console.log("字符串转数字   " +parseInt("1"))
    console.log("字符串转浮点   " +parseFloat("0.12"))
    console.log("是否是数字   " +isNaN("2009/m"))
    console.log("是否是数字   " +isNaN(1))
    console.log("是否是数字   " + isNaN(1.9))
    var url = "my test.asp?name=ståle&car=saab"
    var encode = encodeURI(url)
    var decode =  decodeURI(encode)
    console.log("编码   " +encode)
    console.log("反编码   " +decode)
  }
})